﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UCPage.ascx.cs" Inherits="QueryCommon.UCPage" %>
<input id="btnFirs" type="button" value="&#171;"  onclick="return getFirstPage()" />
<input id="btnPrev" type="button" value="&#139;"  onclick="return getPrevPage()" />
<asp:TextBox ID="tbxNo" Text="1" runat="server" Width="20" Height="20"/>
<input id="btnNext" type="button" value="&#155;"  onclick="return getNextPage()" />
<input id="btnLast" type="button" value="&#187;"  onclick="return getLastPage()" />
总页数：
<asp:TextBox ID="tbxPageNum" Text="" runat="server" Width="20" Height="20" Enabled="false"/>
<script language="javascript" type="text/javascript">
    //通过全局变量使调用页面可以访问tbxPageNum的值
    var globals = {};
    globals.controlIdentities = {};
    globals.controlIdentities.tbxPageNum = '<%= tbxPageNum.ClientID %>';
    globals.controlIdentities.tbxNo = '<%= tbxNo.ClientID %>';

    function getFirstPage() {
        getResultArray(1);
        $get('<%=tbxNo.ClientID%>').value = 1;
    }
    function getPrevPage() {
        var PageNum = lTrim(($get('<%=tbxNo.ClientID%>').value));
        if (isNaN(PageNum) || PageNum.length == 0) return false;
        PageNum = parseInt(PageNum, 10) - 1 <= 0 ? 1 : parseInt(PageNum, 10) - 1
        getResultArray(PageNum);
        $get('<%=tbxNo.ClientID%>').value = PageNum;
    }
    function getNextPage() {
        var PageNum = lTrim(($get('<%=tbxNo.ClientID%>').value));
        if (isNaN(PageNum) || PageNum.length == 0) return false;
        PageNum = parseInt(PageNum, 10) <= 0 ? 1 : parseInt(PageNum, 10) + 1
        getResultArray(PageNum);
        $get('<%=tbxNo.ClientID%>').value = PageNum;
    }
    function getLastPage() {
        getResultArray(0);
        $get('<%=tbxNo.ClientID%>').value = $get('<%=tbxPageNum.ClientID %>').value;
    }
</script>

